home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-02-10 | 1.6 KB | 79 lines | [TEXT/CWIE] |
- // CCMArea version 1.3.2
- // 2-10-98
- // by David Catmull
-
- /* History:
-
- 10-18-97 First created
-
- 12-22-97 Updated for PowerPlant 1.8.1
- Removed Click()
- Updated ClickSelf to check CMClick's return value
-
- 2-10-98 Only calls CMClick when active & enabled
- */
-
- #include "CCMEditText.h"
- #include "CCMWindow.h"
- #include "UCMArea.h"
- #include <LControlImp.h>
- #include <Appearance.h>
-
- void
- CCMEditText::FinishCreateSelf()
- {
- // Make sure mSuperCMArea is set.
-
- if (!mSuperCMArea) {
- LView *superView;
-
- UCMArea::FindSuperCMArea(this,mSuperCMArea,superView);
- }
- }
-
- void
- CCMEditText::ClickSelf(const SMouseDownEvent &inMouseDown)
- {
- // True from CMClick means go ahead and handle the event
-
- if (IsEnabled() && IsActive())
- if (CMClick(inMouseDown) == cm_Nothing)
- LEditText::ClickSelf(inMouseDown);
- }
-
- void
- CCMEditText::GetSelectionDesc(AEDesc &outSelDesc)
- {
- OSErr err;
- ControlEditTextSelectionRec selection;
- TEHandle teH;
-
- // Return either the current selection, or the entire text.
-
- teH = GetMacTEH();
- GetSelection(selection);
- if (selection.selStart == selection.selEnd)
- err = AECreateDesc(typeChar,*(**teH).hText+selection.selStart,
- selection.selEnd-selection.selStart,&outSelDesc);
- else
- err = AECreateDesc(typeChar,*(**teH).hText,(**teH).teLength,&outSelDesc);
- }
-
-
- void
- CCMEditText::BuildMenuSelf(MenuHandle inMenu)
- {
- UCMArea::AddCommandToMenu(inMenu,cmd_Cut);
- UCMArea::AddCommandToMenu(inMenu,cmd_Copy);
- UCMArea::AddCommandToMenu(inMenu,cmd_Paste);
- UCMArea::AddCommandToMenu(inMenu,cmd_SelectAll);
- }
-
- void
- CCMEditText::PreClick(const SMouseDownEvent &inMouseDown)
- {
- #pragma unused (inMouseDown)
-
- LCommander::SwitchTarget(this);
- }
-